package com.qingcheng.dao;

import com.qingcheng.pojo.order.OrderInfoSum;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface OrderInfoSumMapper{

    @Select("SELECT (SELECT COUNT(*) FROM tb_order WHERE create_time > #{date2} AND create_time <= #{date1} ) order_sum,\n" +
            "(SELECT SUM(pay_money) FROM tb_order WHERE create_time > #{date2} AND create_time <= #{date1}) today_pay_sum,\n" +
            "(SELECT SUM(pay_money) FROM tb_order WHERE create_time > #{date3} AND create_time <= #{date2}) yesterday_pay_sum,\n" +
            "(SELECT SUM(pay_money) FROM tb_order WHERE create_time > #{date4} AND create_time<= #{date1}) week_pay_sum")
    public OrderInfoSum findOrder(@Param("date1")String date1, @Param("date2")String date2, @Param("date3")String date3, @Param("date4")String date4);

}
